Skip to content

Use wrapping exceptions to fix truncated stack traces#121

Open
m-dzianishchyts wants to merge 1 commit intodflib:mainfrom
m-dzianishchyts:118-fix-truncated-stack-traces
Open

Use wrapping exceptions to fix truncated stack traces#121
m-dzianishchyts wants to merge 1 commit intodflib:mainfrom
m-dzianishchyts:118-fix-truncated-stack-traces

Conversation

@m-dzianishchyts
Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #118.

Details

The root cause is that JShell's UserException class doesn't preserve the Throwable cause field during serialization, it only carries message, causeExceptionClass, and stackTrace elements. When the exception chain is converted to EvalException by JShell, intermediate causes are discarded.

We can recursively wrap the entire exception cause chain in UserException's using initCause() before passing to JShell. This allows JShell to properly reconstruct the full exception chain.

Testing

Tested manually in jupyter notebook with a test snippet. Full exception chain is now displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception stack trace truncated — cause chain not fully reported

1 participant